/**
 * Created by JLB1 on 2017/1/18.
 */
/*创建app全局对象*/
var app = window.app || {};
app.createBanner = function (boxId,imgList) {
    if (!imgList) imgList = [];
    if($('#' + boxId.length) >0){
        return document.getElementById('boxId')
    }
    var bannerList = new Array();
    var dotList = new Array();
    $.each(imgList,function(i,item){
        bannerList.push('<li><img data-href="'+item.href+'" src="'+item.src+'" alt=""></li>');
        dotList.push('<span></span>')
    });
    var banner = $(bannerList.join(''));
    var dot = $(dotList.join(''));
    $('#slide_list').append(banner);
    $('.slide .dot').append(dot);
    $('#slide_list li img').on('tap',function(){
        window.location.href = this.dataset.href
    });

    $('#' + boxId).swipeSlide({
        continuousScroll: true,
        speed: 3000,
        transitionType: 'cubic-bezier(0.22, 0.69, 0.72, 0.88)',
        firstCallback: function (i, sum, me) {
            me.find('.dot').children().first().addClass('cur');//下标原点
        },
        callback: function (i, sum, me) {
            me.find('.dot').children().eq(i).addClass('cur').siblings().removeClass('cur');
        }
    });
};
app.removeBanner= function(id){
    $('#' + id).remove()
};

app.createTime = function(dataStr){
    var timeInterval = setInterval(function(){
        dataStr += 1000
        console.log(new Date(dataStr))
    },1000);


};